package cn.edu.flink.scala.tutorial.多流转换

import cn.edu.flink.scala.tutorial.source.ClickSource
import org.apache.flink.streaming.api.scala._

object FilterTest {
  def main(args: Array[String]): Unit = {
    val env = StreamExecutionEnvironment.createLocalEnvironmentWithWebUI()

    val clickStream = env.addSource(new ClickSource)

    val maryClickStream = clickStream.filter(_.user == "Mary")
    val aliceClickStream = clickStream.filter(_.user == "Alice")
    val elseStream = clickStream.filter(c => c.user != "Mary" && c.user != "Alice")

    maryClickStream.print("Mary")
    aliceClickStream.print("Alice")
    elseStream.print("Else")

    env.execute("FilterTest")
  }
}
